/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */


$("#calendario").datepicker(
        {
            dateFormat: 'dd/mm/yy',
            dayNames: ['Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado'],
            dayNamesMin: ['D', 'S', 'T', 'Q', 'Q', 'S', 'S', 'D'],
            dayNamesShort: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb', 'Dom'],
            monthNames: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
            monthNamesShort: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
            nextText: 'Próximo',
            prevText: 'Anterior'


        });


jQuery(document).ready(function ($) {
    $('.valorLancamento').maskMoney({prefix: 'R$ ', allowNegative: true, thousands: '.', decimal: ',', affixesStay: false});
    $('.saldoLancamento').maskMoney({prefix: 'R$ ', allowNegative: true, thousands: '.', decimal: ',', affixesStay: false});
    $('.joinStock').maskMoney({prefix: 'R$ ', allowNegative: true, thousands: '.', decimal: ',', affixesStay: false});
});


function AddNewGroupAccount() {

    $('.form-control.lstGrupoDeContas').attr("name", "lstGrupoDeContas_old");
    $('.actionsbuttons').after("<div class=\"form-field groupAccount \"><label>Grupo de Contas:</label> <input type=\"text\"  required=\"\" id=\"newgroupname\" name=\"lstGrupoDeContas\" class=\"form-control newgroupname\" onblur=\"doAjaxPostValidaGroup(this);\"></div>");
    $('#btnenviar').removeAttr("disabled");
    $('.GrupoDeContas').css("display", "none");
    $('.newgroup').css("pointer-events", "none");


}

function RemoveNewGroupAccount() {
    $('.form-field.groupAccount').remove();
    $('.GrupoDeContas').css("display", "block");
    $('#btnenviar').attr("disabled", "disabled");
    $('.newgroup').css("pointer-events", "auto");
}


function AddNewGroupPlanAccount() {

    $('.form-control.lstSubGrupoDeContas').attr("name", "lstSubGrupoDeContas_old");
    $('.GrupoDeContas').after("<div class=\"form-field newSubPlanoDeContas \"><label>Sub Grupo de Contas:</label> <input type=\"text\"  required=\"\" id=\"newsubgroupname\" name=\"lstSubGrupoDeContas\" class=\"form-control newsubgroupname\" onblur=\"\"></div>");
    $('#btnenviar').removeAttr("disabled");
    $('.SubPlanoDeContas').css("display", "none");
    $('.newgroup').css("pointer-events", "none");


}

function RemoveNewGroupPlanAccount() {
    $('.form-field.newSubPlanoDeContas').remove();
    $('.SubPlanoDeContas').css("display", "block");
    $('#btnenviar').attr("disabled", "disabled");
    $('.newgroup').css("pointer-events", "auto");
}

